package pt.mleiria.experiments;

import java.util.BitSet;

public class WhichChars {

	private BitSet used = new BitSet();
	
	public WhichChars(String str){
		for(int i = 0; i < str.length(); i++){
			used.set(str.charAt(i));	//set bit for char
			System.out.println(str.charAt(i) + ":" + (int)str.charAt(i) + ":" + i);
		}
	}
	
	public String toString(){
		String desc = "[";
		for(int i = used.nextSetBit(0); i >= 0; i = used.nextSetBit(i+1)){
			System.out.println("-->" + i);
			desc += (char)i;
		}
		return desc + "]";
	}
}
